<%-- 
    Document   : Prize
    Created on : 14-08-2014, 10:50:38
    Author     : NGOCLINH-PC
--%>

<%@page import="Data.PrizeType"%>
<%@page import="Data.Event"%>
<%@page import="Data.Member"%>
<%@page import="java.util.ArrayList"%>
<%@page import="Data.Prize"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<div class="primarysanpham">
    <div class="menusanpham">
        <div class="menusanpham1">
            <h2 style="padding: 10px; color: #999;">Management Prize</h2>
            <hr />

        </div>
    </div>
    <div class="tablesanpham">
        <div class="tablesanpham1">
            <form action="" method="post" name="frm" id="frm">
                <li style="list-style: none; padding: 10px 10px 0 10px;"><a href="index.jsp?page=addPrize"><img src="../admin/image/Add.png" alt="add" width="98" height="32"/></a></li>
                <table width="100%" border="1" cellspacing="0" cellpadding="4" id="mytable">
                    <tr>
                        <th scope="col">STT</th>

                        <th scope="col">Prize Type</th>
                        <th scope="col">Event</th>
                        <th scope="col">Member</th>
                        <th scope="col">Prize</th>
                        <th scope="col">Status</th>
                        <th scope="col">Actions</th>
                    </tr>
                    <%
                        Prize ct = new Prize();
                        ArrayList<Prize> a = ct.Pselect();
                        int k = 1;
                        if (a.size() > 0) {
                            for (int i = 0; i < a.size(); i++) {
                                Prize cate = a.get(i);
                                out.print("<tr>");
                                out.print("<td>" + k++ + "</td>");
                                // out.print("<td><input name='chk' type='checkbox' value='' /></td>");
                                PrizeType pt = new PrizeType();
                                ArrayList<PrizeType> lspt = pt.PTselectById(cate.getPrizeTypeID());
                                for (int e = 0; e < lspt.size(); e++) {
                                    PrizeType me = lspt.get(e);
                                    out.print("<td>" + me.getPrizeTypeName() + "</td>");
                                }

                                Event ev = new Event();
                                ArrayList<Event> lsEvent = ev.ESelectByID(cate.getEventID());
                                for (int e = 0; e < lsEvent.size(); e++) {
                                    Event me = lsEvent.get(e);
                                    out.print("<td>" + me.getEventName() + "</td>");
                                }
                                Member m = new Member();
                                ArrayList<Member> mb = m.MselectById(cate.getMemberID());
                                for (int u = 0; u < mb.size(); u++) {
                                    Member ma = mb.get(u);
                                    out.print("<td>" + ma.getUsername() + "</td>");
                                }
                                out.print("<td>" + cate.getPrizeName() + "</td>");
                                if (cate.getStatus() == 1) {
                                    out.print("<td><img src='../admin/image/check.png' alt='check' /></td>");
                                } else {
                                    out.print("<td><img src='../admin/image/No_check.png' alt='no_check' /></td>");
                                }
                                out.print("<td><span class='xoa'><a href='index.jsp?page=addPrize&EprizeID=" + cate.getPrizeID() + "'><img src='../admin/image/editBtn.gif' alt='editBtn'  /></a>&nbsp;<a href='../PrizePR?AprizeID=" + cate.getPrizeID() + "' onclick='return confirm(\"Do you want delete!\")'><img src='../admin/image/deleteBtn.gif' alt='deleteBtn' /></a></span></td>");
                                out.print("</tr>");
                            }
                        }
                    %>


                </table>
                <div class="pages"></div>
            </form>
        </div>
    </div>
</div>
